package cn.trda.util;

public class MySqlPageUtil {
	private Integer index=1;	//当前页,默认为1	
	private Integer size = 10; //每页显示10条
	private Integer limitBegin; //limit 分页数据的起始索引
	
	public MySqlPageUtil(Integer index,Integer size){
		this.size = size;
		this.index = index;
		//根据当前面和每页显示数计算出起始索引的值
		this.limitBegin = (index-1)*size;
	}
	//获取总页数 如果需要总页数需要提供总记录数
	public Integer getTotalPage(Integer count){
		return count%size==0?count/size:count/size+1;
	}
	public Integer getIndex() {
		return index;
	}
	public Integer getSize() {
		return size;
	}
	public Integer getLimitBegin() {
		return limitBegin;
	}
}
